UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ni/l7HZRH8V84MPFebLp+QH7BLSMrjYUMP/XTA/n4sk='
WHERE
key_id = 'c6da69520de9cbe0ec6c79aa88d435a2e7319edd12b184aabcdb225d9b3f63cd'
AND (
token = 'Ni/l7HZRH8V84MPFebLp+QH7BLSMrjYUMP/XTA/n4sk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)