UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bQJjPe+qFeBv63315eUArTsfhyAyt8Ie2pR0LT/o9AQ=' 
WHERE 
  key_id = '99d251df97b38b041ec2c2fe8a0b8733a10e5abfe89ae3a44a8392cdff8c9031' 
  AND (
    token = 'bQJjPe+qFeBv63315eUArTsfhyAyt8Ie2pR0LT/o9AQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025