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