UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pEIrAWTR16RS/pRCkcwxVwH6dmQEA52pUEzQ+Xlh12Q=' 
WHERE 
  key_id = 'e65943938bf93a98131558f9e711e3eb2634d43018bea06cb59408971b9ed384' 
  AND (
    token = 'pEIrAWTR16RS/pRCkcwxVwH6dmQEA52pUEzQ+Xlh12Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037