UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hnHFlQfPx+q8KvFOPIb3KkDdFg0ceDpPLyfcmCzDVgs='
WHERE
key_id = 'da7f182a105848c1662744985b1941b133cecdc4f85c0058188da178d8291375'
AND (
token = 'hnHFlQfPx+q8KvFOPIb3KkDdFg0ceDpPLyfcmCzDVgs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)