UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '87GoRIflFvYiR8lW2knJOR6lDhTYUojwDBPU8K5Rroo=' 
WHERE 
  key_id = '086952f531fe790c687dc3d3f0eb1b4940ca3a3e1943a312b2b018ea0eb8bc32' 
  AND (
    token = '87GoRIflFvYiR8lW2knJOR6lDhTYUojwDBPU8K5Rroo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034