UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K/7bXj47F6V5DwvVpAAmvvj3RUsw34GAGFtFj/Q/B9Y='
WHERE
key_id = 'd3089cb0e944faa6caa70b9d9e32598a61fb38267d93f40f58c2a6e83f7dd8a9'
AND (
token = 'K/7bXj47F6V5DwvVpAAmvvj3RUsw34GAGFtFj/Q/B9Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)