UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4IAJHbzUoPI78mSqWPtBULVeXN9woVW6J3df1fGuHPg='
WHERE
key_id = '6689f6dddf6d56cd417977f80a9db7394d4646cf36e01dd1c3cccf69dc205905'
AND (
token = '4IAJHbzUoPI78mSqWPtBULVeXN9woVW6J3df1fGuHPg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)