UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2/qYuB2pAZwTBJCz28GHfAxfQIr4pJ328e46tXbnp04=' 
WHERE 
  key_id = '540e523f63612d0435fe04c37955e36b725d3821d3e1390e358aaba48ab1ab00' 
  AND (
    token = '2/qYuB2pAZwTBJCz28GHfAxfQIr4pJ328e46tXbnp04=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049