UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pFKbv+amZwSIhqey1+zUHNlqm4ll4+wT4Hgwe+mJsU4=' 
WHERE 
  key_id = '8bcf3e9b77c98f048ba14e6245d72de762d38c7e01838569054407e62283b5b0' 
  AND (
    token = 'pFKbv+amZwSIhqey1+zUHNlqm4ll4+wT4Hgwe+mJsU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027