UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RErdVUbjje3AiJ+0yYdIvOEqgHEnZ4lJU0wKucVxB6k=' 
WHERE 
  key_id = '497083951f25214cc2b1cbc69f901dcaee6eee1b1cd2bd4bb670a93d14370182' 
  AND (
    token = 'RErdVUbjje3AiJ+0yYdIvOEqgHEnZ4lJU0wKucVxB6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00075