UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2vUuYKP7cqceegOdEhtGDFTj342VBmMIeypJwlnUAr0=' 
WHERE 
  key_id = '6346634019b1d254515877a16a12891c7fcb57857b799687112c2b1aef6c51b8' 
  AND (
    token = '2vUuYKP7cqceegOdEhtGDFTj342VBmMIeypJwlnUAr0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037