UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+E4x+0pLil5CXwU/xK1RkZnfNNtgGHr4QHEhA0RP+XM=' 
WHERE 
  key_id = '61244dd32db2ab38e63df2569c43bb9dd01da1542a9548639cb2e9c54052e270' 
  AND (
    token = '+E4x+0pLil5CXwU/xK1RkZnfNNtgGHr4QHEhA0RP+XM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028