UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BBG8gc5hqfqlVksw4qnUZdI4gO+fnVR1jA8slXqpnvc='
WHERE
key_id = 'fedf5597a828166b85c80a0d4e7a6ca2e1792e59f24df0cef7d6b8b178dda12b'
AND (
token = 'BBG8gc5hqfqlVksw4qnUZdI4gO+fnVR1jA8slXqpnvc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)