UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MqspjRK8YgBbGmOqiaxppn9Wdrs5KfGuvQeDX223+zE='
WHERE
key_id = 'd1f9c3cc83f6c08184e980f28f866b6ff589c7c42de9d021eb3366730eed7eda'
AND (
token = 'MqspjRK8YgBbGmOqiaxppn9Wdrs5KfGuvQeDX223+zE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)