UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K+vlquYZ9pVd4br25h2Y1VB4sidaOeUDKEjge+oJV50=' 
WHERE 
  key_id = '18d770ab3c7982ad20f393724f2a2b67f48071ed4705a8118941b05c8837dbaf' 
  AND (
    token = 'K+vlquYZ9pVd4br25h2Y1VB4sidaOeUDKEjge+oJV50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030