UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5B5ZeiFpAWt96ugxh2WxCKZH9r9EYqwkVQ2xAGfIVgQ=' 
WHERE 
  key_id = '1b5c4b9ee74a7b12d099ae25c556fe8e729ac6df0d81d5506796d92552fb48e8' 
  AND (
    token = '5B5ZeiFpAWt96ugxh2WxCKZH9r9EYqwkVQ2xAGfIVgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028