UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YlI44/3YHq3WddCtorQS23ObetgN35YmOIhnywUHf+o=' 
WHERE 
  key_id = 'b866f77b47f66cf91a6215487599ea038a7c3f9c660b1f3060e2bc754d6ab6c9' 
  AND (
    token = 'YlI44/3YHq3WddCtorQS23ObetgN35YmOIhnywUHf+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044