UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't9CIAFA2fBnjSBZcQOmby4sqtAyiWmzJAkxDPE99e78='
WHERE
key_id = '37507ce2dd8dbb6b233dd70fc769b00308f5756f80a4544a2154600646df7647'
AND (
token = 't9CIAFA2fBnjSBZcQOmby4sqtAyiWmzJAkxDPE99e78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)