UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aArlEB7ocLrceZZtBU8a4dcNTzCC+xEcJo2zp4x1bG0='
WHERE
key_id = 'fc72bff1a047c0336cd755e09519abb8ae04ba8a5c1e558ae78592695f2edc12'
AND (
token = 'aArlEB7ocLrceZZtBU8a4dcNTzCC+xEcJo2zp4x1bG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)