UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aFQWUEosE/X6oX/bADv9A9C37kDoN8+SuoiVVOteDl4='
WHERE
key_id = 'cc62645f8245a431f45c0e5030e4e44a3adb5c2951a2ea765863b0b3d0967b71'
AND (
token = 'aFQWUEosE/X6oX/bADv9A9C37kDoN8+SuoiVVOteDl4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)