UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zQTHx4qRRvyx8K3YhFpZXj9IX57Cd+fAkmp7IBXlITE='
WHERE
key_id = '330ed982eb9745db27cfc26654ad9b63edd071a0df34aaff58c1cda6998a6ea5'
AND (
token = 'zQTHx4qRRvyx8K3YhFpZXj9IX57Cd+fAkmp7IBXlITE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)