UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IVB9LBEi8PIws00dLchA0NkQ5yPI6f4IYGGoSWNL8WQ=' 
WHERE 
  key_id = 'a2d0f9f9e32628eb6c207b777c0973dfa4e6d393e9df9fe14f1967968c8e668e' 
  AND (
    token = 'IVB9LBEi8PIws00dLchA0NkQ5yPI6f4IYGGoSWNL8WQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030