UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L6Dz+lVkKnt6chpoEF6kqIQqdL/xoInKEhJwvDgkrVo='
WHERE
key_id = 'fe3e4615f0f390227cf4c7335a00655257a29d2816f6694da65136da7e82c04b'
AND (
token = 'L6Dz+lVkKnt6chpoEF6kqIQqdL/xoInKEhJwvDgkrVo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)