UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V1xW0HmbnCcW5kkBzqvbG93J/BIlkkJCvORHS5HNrxE=' 
WHERE 
  key_id = 'a5e891971fbd1531de81056b421d69fe433258d1d239d2a64a0b9af28eb83447' 
  AND (
    token = 'V1xW0HmbnCcW5kkBzqvbG93J/BIlkkJCvORHS5HNrxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025