UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8nXtrJ3K9/wYVMQ0M3MDA6fwXszGX4Brg9BVcAdnit0='
WHERE
key_id = 'bc27df020a47c6db24a8b7f5e125f2d478f26fb85697a13e6257465f3774a07a'
AND (
token = '8nXtrJ3K9/wYVMQ0M3MDA6fwXszGX4Brg9BVcAdnit0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)