UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'frIKMLJor5+747AGrr6zZPmsNQ4eF40ZI97Zjm7paoM='
WHERE
key_id = '5a733d51ff631f16755efd0028b0c50701ae06185cc92fb389ab441e91b3d985'
AND (
token = 'frIKMLJor5+747AGrr6zZPmsNQ4eF40ZI97Zjm7paoM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)