UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dPW0bwtW38HfAwDA1LTK/EV599nYqUybCizDr9rAoJc=' 
WHERE 
  key_id = '2f49bd04ff1ac321d18fd103624064faae044eeedf7f57b32ac20d63a81e146b' 
  AND (
    token = 'dPW0bwtW38HfAwDA1LTK/EV599nYqUybCizDr9rAoJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070