UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xtJ8BRdCRrR3boJw17VG0tNiKRJhsJwmJ2jsvyM1Wtw='
WHERE
key_id = 'b259551582ee3e2e85ba26a2ed1bdd7cc6ef6f201cc20a29ed4ea46d48d5b724'
AND (
token = 'xtJ8BRdCRrR3boJw17VG0tNiKRJhsJwmJ2jsvyM1Wtw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)