UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WLLZlsi9CF1vPwWWD/9uegNwIiYttcfKsALl9x02u0s=' 
WHERE 
  key_id = '8037986f821cdaf63a022e59d578ef8e125d9fe1f0b6659c1b89355d1a29af86' 
  AND (
    token = 'WLLZlsi9CF1vPwWWD/9uegNwIiYttcfKsALl9x02u0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038