UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nZ1OhXfUNLBaXRy7KBQ9a4v9+DXw6VwYIFwipxeq5/c='
WHERE
key_id = 'a9baa23a9ef20a6505ba5c4d15cb53928ab579929ea5635608363e2ffe42b138'
AND (
token = 'nZ1OhXfUNLBaXRy7KBQ9a4v9+DXw6VwYIFwipxeq5/c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)