UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L9burLTQ51CASydXoTEzAFiSinF/o82ib7gcHYWgQIU=' 
WHERE 
  key_id = '4d71d09db1cb576599ccdd31f37d581452143227c1b71b143c5b613b1da9846c' 
  AND (
    token = 'L9burLTQ51CASydXoTEzAFiSinF/o82ib7gcHYWgQIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022