UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BEQUAcNviFubJxXTFu2sYm/nE8pdQMox1/CpQIlsax4='
WHERE
key_id = 'c34498a104b4f6fcd84b28898420118c5475d28d9fb1b052cc5ade54ced8b7dd'
AND (
token = 'BEQUAcNviFubJxXTFu2sYm/nE8pdQMox1/CpQIlsax4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)