UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hjvjkXI+WudEwT1fdxk5S625N1Q0zlkJZv2eagQmuKA='
WHERE
key_id = '31d137ae260b52fc626080775667f6f4b4ff2c7a46c1cfedce6f1e86c8f28636'
AND (
token = 'hjvjkXI+WudEwT1fdxk5S625N1Q0zlkJZv2eagQmuKA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)