UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qBUgIc1AcWv1WssNvFGk8HhnpE9U3vtfg8koilJtrJs='
WHERE
key_id = 'dc45a83d9c9a4e8746f65fedf3e1f2f3ac81b3e73ca7551df2f938de5c22e2ab'
AND (
token = 'qBUgIc1AcWv1WssNvFGk8HhnpE9U3vtfg8koilJtrJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)