UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9MYyhP0s6LSyhP1ZzhpBUNfStvrPtbTzJ0V+x9CRRvA='
WHERE
key_id = 'fe3145defa11fd5fa1a40aa89b6fc5ff0970c0a46eb4f394762637a5de12c328'
AND (
token = '9MYyhP0s6LSyhP1ZzhpBUNfStvrPtbTzJ0V+x9CRRvA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)